<%@ page contentType="text/html;charset=UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery - ajax无刷新保存例子</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/jquery/jquery.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/scripts/jquery/jquery.form.js"></script>
<script type="text/javascript">
 $(document).ready(function() { 
    var options = { 
        target:        '#output',    
		dataType:  'json', 
        beforeSubmit:  showRequest,  
        success:       showXYResponse  
    }; 

  $('#iForm').submit(function() { 
         $(this).ajaxSubmit(options); 
		 // 为了防止普通浏览器进行表单提交和产生页面导航（防止页面刷新？）返回false
        return false; 
    }); 
}); 

function showRequest(formData, jqForm, options) { 
     var queryString = $.param(formData);  
     alert('About to submit: \n\n' + queryString); 
    return true; 
} 

function showResponse(responseText, statusText)  { 
 alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + 
        '\n\nThe output div should have already been updated with the responseText.'); 
} 

function showXYResponse(data)  { 
     alert(data.message); 
} 

</script>
</head>
<body>
<div class="wrap">
<form id="iForm"  name="iForm"  method="post" action="jquery_ajax_post.jsp">
<input type="hidden" id="app_name" name="app_name" value="InvoiceApply">
<center>                  
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;table-layout:fixed;width:725.0">
	<tr>
		<td  rowspan="1" colspan="29" width="100%" height="42.0"><span  style=" height:41px; width:725px; font-family:宋体; font-size:25px; color:#3366FF; vertical-align:middle; font-weight:bold; text-align:center;" >发票申请表</span></td>
	</tr>
	<tr>
		<td  rowspan="1" colspan="7" width="24%" height="35.0"><span  style=" height:34px; width:175px; font-family:宋体; font-size:17px; color:#000000; vertical-align:middle; text-align:left;" >申请人</span></td>
		<td  rowspan="1" colspan="9" width="31%" height="35.0"><span  style=" height:34px; width:225px; font-family:宋体; font-size:17px; color:#000000; vertical-align:middle; text-align:left;" >系统管理员</span></td>
		<td  rowspan="1" colspan="5" width="17%" height="35.0"><span  style=" height:34px; width:125px; font-family:宋体; font-size:17px; color:#000000; vertical-align:middle; text-align:left;" >申请部门</span></td>
		<td  rowspan="1" colspan="8" width="28%" height="35.0"><span  style=" height:34px; width:200px; font-family:宋体; font-size:17px; color:#000000; vertical-align:middle; text-align:left;" >产品开发部</span></td>
	</tr>
	<tr>
		<td  rowspan="1" colspan="7" width="24%" height="35.0"><span  style=" height:34px; width:175px; font-family:宋体; font-size:17px; color:#000000; vertical-align:middle; text-align:left;" >客户名称</span></td>
		<td  rowspan="1" colspan="9" width="28%" height="30.0">
		<input id="customerName" name="customerName" type="text"  value="xxxxxxxxxxxxxxxx" size="20" maxLength="200" required = "true"  displayName="客户名称" style=" width:170px; text-align:left;" class="x-form-text" />&nbsp;<span class="required">*</span></td>
		<td  rowspan="1" colspan="5" width="17%" height="35.0"><span  style=" height:34px; width:125px; font-family:宋体; font-size:17px; color:#000000; vertical-align:middle; text-align:left;" >签订人</span></td>
		<td  rowspan="1" colspan="8" width="28%" height="30.0">
		<input id="signUser" name="signUser" type="text"  value="qqqqq" size="20" maxLength="200" displayName="签订人" style=" width:170px; text-align:left;" class="x-form-text" /></td>
	</tr>
	<tr>
		<td  rowspan="1" colspan="7" width="24%" height="35.0"><span  style=" height:34px; width:175px; font-family:宋体; font-size:17px; color:#000000; vertical-align:middle; text-align:left;" >项目名称</span></td>
		<td  rowspan="1" colspan="9" width="28%" height="30.0">
		<input id="projectName" name="projectName" type="text"  value="xxxxx" size="20" maxLength="200" required = "true"  displayName="项目名称" style=" width:170px; text-align:left;" class="x-form-text" />&nbsp;<span class="required">*</span></td>
		<td  rowspan="1" colspan="5" width="17%" height="35.0"><span  style=" height:34px; width:125px; font-family:宋体; font-size:17px; color:#000000; vertical-align:middle; text-align:left;" >开票金额</span></td>
		<td  rowspan="1" colspan="8" width="28%" height="30.0">
		<input id="money" name="money" type="text"  value="2222.0" displayName="开票金额" size="20" maxLength="10" required = "true"  dataType="DOUBLE"  style=" width:170px; text-align:right;" class="x-form-text"  onKeyPress="return check_double(this);"  />&nbsp;<span class="required">*</span></td>
	</tr>
	
 </table>

<div id="x-toolbar" align="center" style="width: 95%">
  <br/>
	<input type="submit" name="submit" value="保存" class="button" >
	<input type="button" name="button" value="返回 " class="button" onclick="javascript:history.back();" >
 </div>  

</center>
</form>
</div>
<div id="output"></div>
</body>
</html>